package ModelLayer;
import java.util.*;
/**
 * Write a description of class StaffList here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class ContractorList
{
    private static ContractorList instance = null;
    private HashMap<Integer, Contractor> allContractor;

    /**
     * Constructor for objects of class StaffList
     */
    private ContractorList()
    {
        allContractor = new HashMap<Integer, Contractor>();
    }
    
    public static ContractorList getInstance() { 
        if(instance == null) 
            instance = new ContractorList(); 
        return instance; 
    }

    public void addContractor(Contractor contractor){
        allContractor.put((Integer)contractor.getId(), contractor);
    }
    
    public boolean deleteContractor(int id){
        return (allContractor.remove(id) !=null);
    }
    
    public Contractor getContractor(int id){
        if(allContractor.containsKey(id)){
            return allContractor.get(id);
        }
        return null;
    }
    public Iterator getContractorIterator() { return allContractor.values().iterator(); }
    public int getContractorSize() { return allContractor.size(); }
}
